package bstsetcode;

import java.util.Random;

/**
 * @author noob
 * @version 1.0
 * @date 2021/3/13 19:47
 */
public class ArrayGenerator {

    public ArrayGenerator() {
    }




    public static Integer[] generateOrderedArray(int n){
        Integer[] arr = new Integer[n];
        for (int i = 0; i < n; i++) {
            arr[i] = i;
        }
        return arr;
    }

    /**
     * 生成一个长度为n的随机数组，每个数字的范围是:[0,bound)
     * @param n 数组长度
     * @param bound 边界
     * @return 随机数组arr
     */
    public static Integer[] generateRandomArray(int n,int bound){
        Integer[] arr = new Integer[n];
        Random random = new Random();
        for (int i = 0; i < n; i++) {
            arr[i] = random.nextInt(bound);
        }
        return arr;
    }

}
